/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ve.com.cantv.worktables.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ghust
 */
@Entity
@Table(name = "rol")
@NamedQueries({@NamedQuery(name = "Rol.findAll", query = "SELECT r FROM Rol r"), @NamedQuery(name = "Rol.findByIdrol", query = "SELECT r FROM Rol r WHERE r.idrol = :idrol"), @NamedQuery(name = "Rol.findByName", query = "SELECT r FROM Rol r WHERE r.name = :name"), @NamedQuery(name = "Rol.findByIduser", query = "SELECT r FROM Rol r WHERE r.iduser = :iduser"), @NamedQuery(name = "Rol.findByDatechange", query = "SELECT r FROM Rol r WHERE r.datechange = :datechange")})
public class Rol implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idrol")
    private Integer idrol;
    @Column(name = "name")
    private String name;
    @Column(name = "iduser")
    private Integer iduser;
    @Column(name = "datechange")
    @Temporal(TemporalType.DATE)
    private Date datechange;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rol")
    private Collection<Roltask> roltaskCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rol")
    private Collection<Rolmodule> rolmoduleCollection;
    @OneToMany(mappedBy = "idrol")
    private Collection<UUser> uUserCollection;

    public Rol() {
    }

    public Rol(Integer idrol) {
        this.idrol = idrol;
    }

    public Integer getIdrol() {
        return idrol;
    }

    public void setIdrol(Integer idrol) {
        this.idrol = idrol;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getIduser() {
        return iduser;
    }

    public void setIduser(Integer iduser) {
        this.iduser = iduser;
    }

    public Date getDatechange() {
        return datechange;
    }

    public void setDatechange(Date datechange) {
        this.datechange = datechange;
    }

    public Collection<Roltask> getRoltaskCollection() {
        return roltaskCollection;
    }

    public void setRoltaskCollection(Collection<Roltask> roltaskCollection) {
        this.roltaskCollection = roltaskCollection;
    }

    public Collection<Rolmodule> getRolmoduleCollection() {
        return rolmoduleCollection;
    }

    public void setRolmoduleCollection(Collection<Rolmodule> rolmoduleCollection) {
        this.rolmoduleCollection = rolmoduleCollection;
    }

    public Collection<UUser> getUUserCollection() {
        return uUserCollection;
    }

    public void setUUserCollection(Collection<UUser> uUserCollection) {
        this.uUserCollection = uUserCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idrol != null ? idrol.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rol)) {
            return false;
        }
        Rol other = (Rol) object;
        if ((this.idrol == null && other.idrol != null) || (this.idrol != null && !this.idrol.equals(other.idrol))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.com.cantv.worktables.ejb.entity.Rol[idrol=" + idrol + "]";
    }

}
